package com.work.util;

import com.work.pojo.email;

import java.util.ArrayList;
import java.util.List;

/**
 * @program: myProject
 * @description:
 *  分页工具类
 * @author: lan
 * @create: 2021-05-21 10:40
 * @version:1.0
 **/
public class PageUtil {


    public static List<email> page(List<email> email, Integer pageSize, Integer pageNum){
        List<email> rs = new ArrayList<>();
        int num1 = pageSize*(pageNum-1);
        int num2 = pageNum*pageSize;
        //System.out.println("Size:"+email.size());
        if(pageNum*pageSize>email.size()){
            num2 = email.size();
        }
        for (int i = num1; i < num2; i++) {
            //System.out.println(email.get(i));
            rs.add(email.get(i));
        }
        return rs;
    }


}
